import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/home/index.vue'

Vue.use(VueRouter)

const routes = [
  // 进入项目展示的第一个页面  
  {
    path: '/',
    redirect: "/home"
  },
  {
    path: '/about',
    name: 'About',
    component: () => import('../views/About.vue')
  },
  {
    path: '/home',
    name: 'home',
    component: Home,
    meta: {
      keepAlive: true
    }
  },
  {
    path: '/home/detail',
    name: 'detail',
    component: () => import('../views/home/detail/index.vue')
  },
  {
    path: '/home/brand',
    name: 'brand',
    component: () => import('../views/home/brand/index.vue')
  },
  {
    path: '/home/newgoods/:id',
    name: 'newgoods',
    component: () => import('../views/home/newgoods/index.vue')
  },
  {
    path: '/home/city',
    name: 'home/city',
    component:  () => import('../views/home/city/index.vue')
  },
  {
    path: '/topic',
    name: 'topic',
    component: () => import('../views/topic/index.vue')
  },
  {
    path: '/topic/topicDetail',
    name: 'topicDetail',
    component: () => import('../views/topic/topicDetail')
  },
  {
    path: '/category',
    name: 'category',
    component: () => import('../views/category/index.vue')
  },
  {
    path: '/category/categorylist',
    name: 'categorylist',
    component: () => import('../views/category/categoryList')
  },
  {
    path: '/category/detail',
    name: 'category/detail',
    component: () => import('../views/category/detail/index.vue')
  },

  {
    path: '/cart',
    name: 'cart',
    component: () => import('../views/cart/index.vue')
  },
  
  {
    path: '/cart/order',
    name: 'cart/order',
    component: () => import('../views/cart/order/index.vue')
  },
  {
    path: '/cart/addressEdit',
    name: 'cart/addressEdit',
    component: () => import('../views/cart/addressEdit/index.vue')
  },
  {
    path: '/cart/addAddress',
    name: 'cart/addAddress',
    component: () => import('../views/cart/addAddress/index.vue')
  },
  {
    path: '/mine',
    name: 'mine',
    component: () => import('../views/mine/index.vue')
  },
  {
    path: '/mine/collection',
    name: 'mine/collection',
    component: () => import('../views/mine/collection/index.vue')
  },
  {
    path: '/mine/feedback',
    name: 'mine/feedback',
    component: () => import('../views/mine/feedback/index.vue')
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
